package model.macro
{
	
	/**
	 */
	public class Armor
	{
		// Types of armor
		static public const CLOTH:Armor = new Armor("Cloth", 5, 0, 2, 1);
		static public const LEATHER:Armor = new Armor("Leather", 8, 1, 4, 2);
		static public const CHAINMAIL:Armor = new Armor("Chainmail", 12, 3, 8, 3);
		static public const FULLPLATE:Armor = new Armor("Fullplate", 15, 5, 10, 4);
		static public const STONE_WALL:Armor = new Armor("Stone Wall", 2, 100, 10, 20);
		
		/** Constant used in converting armor value to percent reduction.
		 * Larger values increase reduction. */
		static private const ARMOR_MULT:Number = .0095;
		
		/** Name of the type of armor */
		private var _name:String;
		/** Affects percent reduction. */
		private var _armor_value:int;
		/** Flat amount damage is reduced by. */
		private var _damage_reduction:int;
		/** Weight that influences speed of unit. */
		private var _weight:int;
		/** Cost of the armor. */
		private var _cost:int;
		
		/**
		 * Create a new armor
		 */
		public function Armor(name:String, base_armor:int, damage_reduction:int, base_weight:int, cost:int)
		{
			_damage_reduction = damage_reduction;
			_name = name;
			_armor_value = base_armor;
			_weight = base_weight;
			_cost = cost;
		}
		
		/**
		 * @return	name
		 */
		public function get name():String
		{
			return _name;
		}
		
		/**
		 * @return	armor value
		 */
		public function get armor_value():int
		{
			return _armor_value;
		}
		
		/**
		 * @return	The multiplier for reducing damage.
		 */
		public function get armorMultiplier():Number
		{
			return Math.pow(7, (-ARMOR_MULT * armor_value));
		}
		
		/**
		 * The flat amount damage is reduced by.
		 * @return damage reduction
		 */
		public function get damage_reduction():int
		{
			return _damage_reduction;
		}
		
		/**
		 * @return	weight
		 */
		public function get weight():int
		{
			return _weight;
		}
		
		/**
		 * @return cost
		 */
		public function get cost():int
		{
			return _cost;
		}
	}

}